<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>后台管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="${AppPath}/css/font.css">
    <link rel="stylesheet" href="${AppPath}/css/index.css">
    <link rel="stylesheet" href="${AppPath}/css/iconfont.css">
    <link rel="stylesheet" href="${AppPath}/css/font-awesome.min.css">
    <link rel="stylesheet" href="${AppPath}/css/login.css">
    <link rel="stylesheet" href="${AppPath}/layer/skin/default/layer.css">


</head>
<body class="index">
<!-- 顶部开始 -->
<div class="container">
    <div class="logo">
        <a href="./index.html">后台管理系统</a></div>
    <div class="left_open">
        <a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
    </div>



    <ul class="layui-nav right" lay-filter="" style="margin-right:100px ">
        <li class="new-nav" id="gonggao">
            <i></i>
            <a href="#"><i class="iconfont">&#xe6bc;</i><span class="layui-badge">1</span></a>
            <!--<dl class="layui-nav-child">-->
            <ul class="news" id="gonggaos" style="display: none;">
                <li class="dropdown-header"><i class="iconfont">&#xe6bc;</i>1条公告</li>
                <li> 当前在线人数<span><font color="#33971c">${applicationScope.online} </font></span>人 </li>
            </ul>
            <!--</dl>-->

        </li>
        <li class="new-nav" id="new-nav" >
            <i></i>
            <a href="#"><i class="iconfont">&#xe713;</i><span class="layui-badge">1</span></a>
            <!--<dl class="layui-nav-child">-->
            <ul class="news" id="news" style="display: none;">
                <li class="dropdown-header"><i class="iconfont">&#xe6bc;</i>1条通知</li>

                <li> 当前时间:<span id="time"></span></li>

            </ul>
            <!--</dl>-->

        </li>
        <li class="layui-nav-item">
            <a id="user_name" href="javascript:;">${user.uname}</a>
            <dl class="layui-nav-child">
                <!-- 二级菜单 -->
                <dd>
                    <a onclick="info()">个人信息查看</a><input type="hidden" name="roleStatus" value="${sessionScope.user.roleStatus}"></dd>

                <dd>
                    <a onclick="xadmin.open('修改密码','${AppPath}/updatePwd')">修改密码</a></dd>
                <dd>
                    <a id="quit" href="${AppPath}/quitAjax" >安全退出</a></dd>

            </dl>
        </li>

    </ul>



</div>
</body>
<script src="${AppPath}/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="${AppPath}/js/index.js"></script>
<script src="${AppPath}/jquery/jquery-2.1.1.min.js"></script>
<script src="${AppPath}/bootstrap/js/bootstrap.min.js"></script>
<script src="${AppPath}/script/docs.min.js"></script>
<script src="${AppPath}/layer/layer.js"></script>

</html>

 <script type="text/javascript">
    window.onload=function () {
        var click=document.getElementById('new-nav');
        var news=document.getElementById('news');
        click.addEventListener('mousemove',function () {
            news.style.display='block';
        });
        click.addEventListener('mouseout',function () {
            news.style.display='none';
        });

        var gonggao=document.getElementById('gonggao');
        var gonggaos=document.getElementById('gonggaos');
        gonggao.addEventListener('mousemove',function () {
            gonggaos.style.display='block';
        });
        gonggao.addEventListener('mouseout',function () {
            gonggaos.style.display='none';
        });
    }

     $(function () {

         window.setInterval(function () {
             var user_name= $("#user_name").text();

             if(user_name=="null"||user_name==""){
                 layer.msg("你的账号已失效",{time:1000,icon:5,shift:6},function () {
                     location.href="${AppPath}/quit";
                 });
             }




         },5000);
        $("#quit").click(function () {
           var href= $(this).attr("href");
           $.ajax({
               url:href,
               type:"post",
               success:function(data){

                       layer.msg("正在退出,请稍后",{time:1000,icon:6},function () {
                           location.href="${AppPath}/quit";
                       });




               }
           })
            return false;
        })
     })
  function  info() {
        var s=$("input[name=roleStatus]").val();

        if(s=="1"){
            xadmin.open('查看个人信息','${AppPath}/user/empInfo')

        }else if(s=="2"){
            xadmin.open('查看个人信息','${AppPath}/user/studentInfo')

      }else if(s=="3"){
            xadmin.open('查看个人信息','${AppPath}/user/companyInfo')

        }

  }
    function getTime(){
        var myDate = new Date();
        var myYear = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
        var myMonth = myDate.getMonth()+1; //获取当前月份(0-11,0代表1月)
        var myToday = myDate.getDate(); //获取当前日(1-31)
        var myDay = myDate.getDay(); //获取当前星期X(0-6,0代表星期天)
        var myHour = myDate.getHours(); //获取当前小时数(0-23)
        var myMinute = myDate.getMinutes(); //获取当前分钟数(0-59)
        var mySecond = myDate.getSeconds(); //获取当前秒数(0-59)
        var week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
        var nowTime;

        nowTime = myYear+'-'+fillZero(myMonth)+'-'+fillZero(myToday)+'&nbsp;&nbsp;'+fillZero(myHour)+':'+fillZero(myMinute)+':'+fillZero(mySecond)+'&nbsp;&nbsp;'+week[myDay]+'&nbsp;&nbsp;';
        //console.log(nowTime);
        str="<font color='#33971c'>" +nowTime+"</font>";
        $('#time').html(str);
    };
    function fillZero(str){
        var realNum;
        if(str<10){
            realNum	= '0'+str;
        }else{
            realNum	= str;
        }
        return realNum;
    }
    setInterval(getTime,1000);

</script>

